package thelperinator

import com.google.maps.*
import com.google.maps.model.DirectionsLeg


/**
 * Created by silas on 3/7/15.
 */
class maps {

    def origin = "311+Osage+Drive,+311+Osage+Drive,+Salinas,+CA+93906"
    def destination = "+1+Ferry+building,+San+Francisco,+CA+94111"

    def maps() { }

    def maps(origin, destination) {
        this.origin = origin
        this.destination = destination
    }

    def test() {

        GeoApiContext context = new GeoApiContext().setApiKey("AIzaSyC74KJTSNugclfQO8DScu0wQRksiTAH-mY");



        def directions = DirectionsApi.getDirections(context, origin, destination).await()


        DirectionsLeg[] leg = directions[0].legs
        println "This journey will take ${leg[0].duration.humanReadable}"
        def route = leg[0]

        leg[0].steps.each { println it.htmlInstructions }

    }
}
